{extend name="base" /}

{block name="title"}我的刷单{/block}

{block name="resource"}
<script type="text/javascript" charset="utf-8" src="/js/GetRTime.js?v=0.0.1"></script>
{/block}

{block name="main"}
<div class="main">
	<div class="container">
		<div class="qd_box">
			<div class="table_modal">

				<div class="tab_title"><p>我的刷单</p></div>

				<div class="qd_table_box">
					<div class="table-responsive">
					  	<table class="table text-center table-bordered">
					    	<tr>
					    		<th>流水号</th>
					    		<th>提现用户</th>
					    		<th>提现姓名</th>
					    		<th>提现帐户</th>
					    		<th>来自</th>
					    		<th>打款/回款时间</th>
					    		<th>交易状态</th>
					    		<th>预计收益</th>
					    		<th>打款金额</th>
					    		<th>操作</th>
					    	</tr>
					    	{volist name="help_tos" id="help_to"}
					    	<tr>
					    		<td>{$help_to.order_id}</td>
					    		<td>{$help_to.username}</td>
					    		<td>{$help_to.realname}</td>
					    		<td>
					    			<a href="#zfxq_{$help_to.help_to_id}" class="ale_btn">
					    				<p>云支付({$help_to.bank_code})</p>
					    				<p>点击查看详情>></p>
					    			</a>

					    			<div class="zhegai" id="zfxq_{$help_to.help_to_id}" style="display: none;">
										<div class="login">
											<a href="javascript:;" class="clos"></a>
											<div class="zhmm">
												<div class="ale_box_title">接单人</div>
												<div class="ale_body" style="padding: 10px;">
													<div class="table-responsive">
													  	<table class="table text-center table-bordered">
													    	<tr>
													    		<th>用户名</th>
													    		<th>真实姓名</th>
													    		<!--<th>手机</th>-->
													    		<th>打款金额</th>
													    		<th>云付通账号</th>
													    	</tr>
													    	<tr>
													    		<td>{$help_to.username}</td>
													    		<td>{$help_to.realname}</td>
													    		<!--<td>{/*$help_to.phone*/}</td>-->
													    		<td>{$help_to.money}</td>
													    		<td>{$help_to.bank_code}</td>
													    	</tr>
													  	</table>
													 </div>
												</div>
											</div>
										</div>
									</div>

					    		</td>
					    		<td>{$help_to.help_get_from}</td>
					    		<td>
									{switch name="help_to->getData('status')" }
										{case value="1"}
										<p>{$help_to.begin_time|date='Y-m-d H:i:s',###}</p>
										<p id="GetRTime_{$help_to.help_to_id}" style="color: red;"></p>
					    				<script>GetRTime("{:date('Y-m-d H:i:s', $help_to['begin_time'] + getParam('HELP_TO_MONEY_OVERTIME') * 60 * 60)}","GetRTime_{$help_to.help_to_id}");</script>
										{/case}
										{case value="4"}
										{gt name="help_to.end_time" value="0"}
											<p>{$help_to.end_time|date='Y-m-d H:i:s',###}</p>
											<p id="GetRTime_{$help_to.help_to_id}" style="color: red;"></p>
						    				<script>GetRTime("{:date('Y-m-d H:i:s', $help_to['end_time'])}","GetRTime_{$help_to.help_to_id}");</script>
						    			{/gt}
										{/case}
									{/switch}
					    		</td>
					    		<td><p>{$help_to.status}</p></td>
					    		<td>
					    			<p>普通：<span class="color_ceng">{:getParam('HELP_TO_MONEY_INCOME') / 100 * $help_to.money + $help_to.money}</span></p>
					    			<p>VIP：<span class="color_ceng">{:getParam('HELP_TO_VIP_MONEY_INCOME') / 100 * $help_to.money + $help_to.money}</span></p>
					    		</td>
					    		<td>
					    			<p><span class="color_ceng">{$help_to.money}</span>元</p>
					    			<!--<p><span class="color_ceng">0</span>元</p>-->
					    		</td>
					    		<td>
					    			{eq name="help_to->getData('status')" value="1"}
					    				{eq name="help_to->h_g_user_id" value="1"}
					    				<a href="javascript:firstConfirmHelpTo({$help_to.help_to_id});">确认打款</a>
					    				{else /}
					    				<a href="javascript:confirmHelpTo({$help_to.help_to_id});">确认打款</a>
					    				{/eq}
					    			{/eq}
					    		</td>
					    	</tr>
					    	{/volist}
					  	</table>
					</div>
					<nav>{$help_tos->render()}</nav>
				</div>
			</div>
			
		</div>

	</div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
	function firstConfirmHelpTo(help_to_id) {
		if(window.confirm('是否确认已经打款?')) {
			$.post('/farming/firstConfirmHelpTo', {
				help_to_id: help_to_id
			}, function(result) {
				if(result.code == 0) {
					alert(result.message);
					window.location.href = "/farming";
				} else {
					alert(result.message);
				}
			}, 'json');
		}
	}

	function confirmHelpTo(help_to_id) {
		if(window.confirm('是否确认已经打款?')) {
			$.post('/farming/confirmHelpTo', {
				help_to_id: help_to_id
			}, function(result) {
				if(result.code == 0) {
					alert(result.message);
					window.location.href = "/farming";
				} else {
					alert(result.message);
				}
			}, 'json');
		}
	}
</script>
{/block}